package com.hkh.erp.system.bean.user;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 很多系统将系统用户与组织架构人员混为一谈，导致系统设计耦合，可扩展性较差。
 * 理想的做法是将用户、权限与组织架构进行分离，这样才能做到灵活。
 * （比如：在审批流程中，普通员工只要赋予了指定权限就能审核，而不用在程序代码中硬编码实现逻辑）
 *
 */
@Data
@ApiModel(value = "用户视图")
@Entity
@Table(name = "sys_user")
public class UserBean implements Serializable {
    private static final long serialVersionUID = 1766072739193979349L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @ApiModelProperty(value = "主键ID")
    private Long id;

    @ApiModelProperty(value = "用户编号")
    @Column(name = "userNo",columnDefinition="varchar(20) not null comment '用户编号'")
    private String userNo;

    @ApiModelProperty(value = "用户名")
    @Column(name = "userName",columnDefinition="varchar(20) not null comment '用户名'")
    private String userName;

    @ApiModelProperty(value = "密码")
    @Column(name = "password",columnDefinition="varchar(32) comment '密码'")
    private String password;

    @ApiModelProperty(value = "用户状态：1启用状态、2停用状态")
    @Column(name = "userStatus",columnDefinition="smallint not null default 1 comment '用户状态：1启用状态、2停用状态'")
    private Integer userStatus;

    @ApiModelProperty(value = "手机号")
    @Column(name = "phone",columnDefinition="varchar(20) comment '手机号'")
    private String phone;

    @ApiModelProperty(value = "员工编号")
    @Column(name = "hrNo",columnDefinition="varchar(20) comment '员工编号'")
    private String hrNo;

    @ApiModelProperty(value = "头像")
    @Column(name = "avatar",columnDefinition="varchar(100) comment '头像'")
    private String avatar;

    @ApiModelProperty(value = "电子邮件地址")
    @Column(name = "email",columnDefinition="varchar(100) comment '电子邮件地址'")
    private String email;

    @ApiModelProperty(value = "wx")
    @Column(name = "wx",columnDefinition="varchar(50) comment 'wx'")
    private String wx;

    @ApiModelProperty(value = "QQ")
    @Column(name = "qq",columnDefinition="varchar(20) comment 'qq'")
    private String qq;

    @ApiModelProperty(value = "钉钉")
    @Column(name = "dd",columnDefinition="varchar(30) comment '钉钉'")
    private String dd;

    @ApiModelProperty(value = "最近登录时间")
    @Column(name = "lastLoginTime",columnDefinition="datetime comment '最近登录时间'")
    private LocalDateTime lastLoginTime;

    @ApiModelProperty(value = "注册时间")
    @Column(name = "registerTime",columnDefinition="datetime comment '注册时间'")
    private LocalDateTime registerTime;

    @ApiModelProperty(value = "登录次数")
    @Column(name = "loginTimes",columnDefinition="smallint default 0 comment '登录次数'")
    private Integer loginTimes;

    @Column(name = "createTime",columnDefinition="datetime comment '创建时间'")
    @ApiModelProperty(value = "创建时间")
    private LocalDateTime createTime;

    @Column(name = "updateTime",columnDefinition="datetime comment '更新时间'")
    @ApiModelProperty(value = "更新时间")
    private LocalDateTime updateTime;

    @Column(name = "deleteFlag",columnDefinition="bit not null default false comment '删除标记'")
    @ApiModelProperty(value = "删除标记")
    private Boolean deleteFlag;

    @Column(name = "createUser",columnDefinition="varchar(20) null comment '创建人'")
    @ApiModelProperty(value = "创建人")
    private String createUser;

    @Column(name = "updateUser",columnDefinition="varchar(20) null comment '更新人'")
    @ApiModelProperty(value = "更新人")
    private String updateUser;

}
